package mqtt

import (
	"fmt"
	MQTT "github.com/eclipse/paho.mqtt.golang"
	"miomp-terminal-suite/backend/log"
	"miomp-terminal-suite/backend/pkg/mqtt"
)

type dashboard struct{}

var baseDashboard = &dashboard{}

func (b *dashboard) HandlerTestMes() MQTT.MessageHandler {

	return func(client MQTT.Client, msg MQTT.Message) {
		message, err := handlerMessage(&mqtt.TestMsg{}, msg)
		if err != nil {
			return
		}
		go handlerTestMesHandler(message)
	}
}

func handlerTestMesHandler(msg *mqtt.Message[*mqtt.TestMsg]) {
	log.LOG.Info(fmt.Sprintf("TOPIC msg: %s", msg.Payload))
}
